package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.Comment;
import cn.tedu._04mybatis.pojo.CommentVO1;
import cn.tedu._04mybatis.pojo.CommentVO2;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
//    @Insert("INSERT INTO comment(content,created,weibo_id ,user_id) "+
//            "VALUES (#{content},#{created},#{weiboId},#{userId})")
    int insertComment(Comment comment);

//    @Delete("DELETE FROM comment WHERE id= #{id}")
    int deleteComment(Integer id);

//    @Update("UPDATE comment " +
//            "SET content=#{content} " +
//            "WHERE id=#{id}")
    int updateContent(Comment comment);

//    @Select("SELECT id,content,weibo_id weiboId,user_id userId " +
//            "FROM comment " +
//            "WHERE id=#{id}")
    CommentVO1 selectCommentById(Integer id);


//    @Select("SELECT content,user_id userId " +
//            "FROM comment " +
//            "WHERE weibo_id=#{weiboId}")
    List<CommentVO2> selectCommentVO2ById(Integer weiboId);
}
